package practice04;

/**
 * @author Administrator
 * @version V1.0
 * @ProjectName:IntelliJ IDEA
 * @PackageName: practice01
 * @ClassName: AddCal
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @date 2019/12/3 10:38
 * @Copyright 大牛版板所有
 */
public class AddCal {
    public int add(int num1,int num2){
        int sum;
        sum = num1 + num2;
        return sum;
    }

    public int add(int num1,int num2,int num3){
        int sum;
        sum = num1 + num2 + num3;
        return sum;
    }

    public double add(double num1,double num2){
        double sum;
        sum = num1 + num2;
        return sum;
    }

    public float add(float num1,float num2){
        float sum;
        sum = num1 + num2;
        return sum;
    }

    public static void main(String[] args) {
        AddCal sum = new AddCal();
        int s1 = sum.add(2,5);
        System.out.println("两个整数求和结果为："+s1);
        s1 = sum.add(2,5,7);
        System.out.println("三个整数求和结果为："+s1);
        double s2 = sum.add(2.3,5.7);
        System.out.println("两个小数求和结果为（double型）："+s2);
        float s3 = sum.add(2.5f,5.5f);
        System.out.println("两个小数求和结果为（float型）："+s3);
    }
}
